Cherry-pick #24480 to 7.x: Improve ILM policy and alias setup log output #24794
+94
−36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #24480 to 7.x branch. Original message:
What does this PR do?
The idxmgmt has not all 'information' to properly log the outcome of the
policy and status setup. The PR moves the reporting to the ILM package
directly, and 'unifies' the logic of EnsurePolicy and EnsureAlias.
Why is it important?
The change fixes the status reporting for the ILM and index alias setup, that is written to the logs.
With the fix one can tell if some resources have been installed, or not, depending on the actual settings in the configuration file. Before it was potentially reported that a policy/alias has been created, although the creation of the resources was disabled.
The change also updates EnsurePolicy/EnsureAlias to follow a similar pattern, which makes it a little easier to follow the code. We now allow EnsureAlias to create the first index and alias if
check_exists: false
andoverwrite: true
. If the alias already exists, no new alias will be created, as Elasticsearch will return an error.This change in semantics fixes a setup that has ILM enabled with aforementioned settings, potentially indexing without the appropriate alias/index being setup ahead of time.
Checklist
- [ ] I have commented my code, particularly in hard-to-understand areas- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Related issues